package com.jiyinit.web.core.business.service;

import com.jiyinit.core.framework.base.paging.PagingResult;
import com.jiyinit.web.core.business.dao.TabCoreRoleDao;
import com.jiyinit.web.core.business.dto.RolePageRequest;
import com.jiyinit.web.core.business.entity.TabCoreRoleEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p></p>
 * <p>
 * <PRE>
 * <BR>	修改记录
 * <BR>-----------------------------------------------
 * <BR>	修改日期			修改人			修改内容
 * </PRE>
 *
 * @author lishaochuan
 * @version 1.0
 * @date 2017/4/19 17:30
 * @since 1.0
 */
@Service("core.roleServiceImpl")
public class RoleServiceImpl {

    @Resource(name = "core.tabCoreRoleDao")
    private TabCoreRoleDao roleDao;


    /**
     * 根据角色ID查询角色
     * @author lishaochuan
     * @create 2017/4/20 11:32
     * @param
     * @return
     */
    public TabCoreRoleEntity selectRoleById(int roleId){
        return roleDao.selectRoleById(roleId);
    }

    /**
     * 分页查询角色
     * @author lishaochuan
     * @create 2017/4/19 17:32
     * @param
     * @return
     */
    public PagingResult<TabCoreRoleEntity> selectRoleForPage(RolePageRequest rolePageRequest){
        return roleDao.selectRoleForPage(rolePageRequest);
    }

    /**
     * 查询所有角色
     * @author zhaolaiwei
     * @create 2017/4/20 09:35
     * @return
     */
    public List<TabCoreRoleEntity> selectAll(){
        return roleDao.selectAll();
    }


    /**
     * 保存角色
     * @author lishaochuan
     * @create 2017/4/20 11:04
     * @param
     * @return
     */
    public int save(TabCoreRoleEntity tabCoreRoleEntity){
        return roleDao.save(tabCoreRoleEntity);
    }


    /**
     * 修改角色
     * @author lishaochuan
     * @create 2017/4/20 11:44
     * @param
     * @return
     */
    public int update(TabCoreRoleEntity tabCoreRoleEntity){
        return roleDao.update(tabCoreRoleEntity);
    }


    /**
     * 逻辑删除角色
     * @author lishaochuan
     * @create 2017/4/20 14:06
     * @param
     * @return
     */
    public int deleteByRoleIds(Integer[] roleIds){
        return roleDao.deleteByRoleIds(roleIds);
    }
}
